home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / pmake / lst / RCS / lstOpen.c,v < prev    next >
Encoding:
Text File  |  1992-05-19  |  2.0 KB  |  81 lines

  1. head     1.6;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.6
  10. date     88.11.17.20.53.43;  author adam;  state Exp;
  11. branches ;
  12. next     ;
  13.  
  14.  
  15. desc
  16. @@
  17.  
  18.  
  19.  
  20. 1.6
  21. log
  22. @checked in with -k by kupfer at 92.05.18.17.32.45.
  23. @
  24. text
  25. @/*-
  26.  * LstOpen.c --
  27.  *    Open a list for sequential access. The sequential functions access the
  28.  *    list in a slightly different way. CurPtr points to their idea of the
  29.  *    current node in the list and they access the list based on it.
  30.  *    If the list is circular, Lst_Next and Lst_Prev will go around
  31.  *    the list forever. Lst_IsAtEnd must be used to determine when to stop.
  32.  *
  33.  * Copyright (c) 1988 by University of California Regents
  34.  *
  35.  * Permission to use, copy, modify, and distribute this
  36.  * software and its documentation for any purpose and without
  37.  * fee is hereby granted, provided that the above copyright
  38.  * notice appears in all copies.  Neither the University of California nor
  39.  * Adam de Boor makes any representations about the suitability of this
  40.  * software for any purpose.  It is provided "as is" without
  41.  * express or implied warranty.
  42.  */
  43. #ifndef lint
  44. static char *rcsid =
  45. "$Id: lstOpen.c,v 1.6 88/11/17 20:53:43 adam Exp $ SPRITE (Berkeley)";
  46. #endif lint
  47.  
  48. #include    "lstInt.h"
  49.  
  50. /*-
  51.  *-----------------------------------------------------------------------
  52.  * Lst_Open --
  53.  *    Open a list for sequential access. A list can still be searched,
  54.  *    etc., without confusing these functions.
  55.  *
  56.  * Results:
  57.  *    SUCCESS or FAILURE.
  58.  *
  59.  * Side Effects:
  60.  *    isOpen is set TRUE and curPtr is set to NilListNode so the
  61.  *    other sequential functions no it was just opened and can choose
  62.  *    the first element accessed based on this.
  63.  *
  64.  *-----------------------------------------------------------------------
  65.  */
  66. ReturnStatus
  67. Lst_Open (l)
  68.     register Lst    l;
  69. {
  70.     if (LstValid (l) == FALSE) {
  71.         return (FAILURE);
  72.     }
  73.     ((List) l)->isOpen = TRUE;
  74.     ((List) l)->atEnd = LstIsEmpty (l) ? Head : Unknown;
  75.     ((List) l)->curPtr = NilListNode;
  76.  
  77.     return (SUCCESS);
  78. }
  79.  
  80. @
  81.